package com.dyh.quickdemo.bizDemo.asyncFail;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import java.util.concurrent.ForkJoinPool;

/*
@Author=Joey Wheeler
@Date=2020/11/16 9:26
*/
@Slf4j
public class AsyncFailTest {

    @Test
    public void test(){
        try {
            fun();
        } catch (Exception e) {
            log.error("发现异常");
        }
    }

    public void fun(){
        step1();
        ForkJoinPool.commonPool().execute(this::step2);
//        if (1==1)
//            throw new RuntimeException();
        log.info("fun has done");
    }

    public void step1(){
        log.info("step1");
    }

    public void step2(){
        log.info("step2....start");
        if (1==1)
            throw new RuntimeException();
        log.info("step2....end");
    }
}
